import {useState} from "react"


export function MyBrother(){
    const [count,setCount] = useState(1)
    return (
        <div>
            <h2>公共----{count}</h2>

            <A count={count} setCount={setCount}></A>

            <B count={count}></B>
        </div>
    )
}

function A (props){
    return (
        <div>
            A组件---<button onClick={()=>props.setCount(props.count+1)}>{props.count}</button>
        </div>
    )
}

function B (props){
    return (
        <div>
            B组件---{props.count}
        </div>
    )
}